package com.wshx.qtbigdata.media2;

import android.app.Application;
import android.content.Context;
import android.os.Environment;

import java.io.File;

import mabeijianxi.camera.VCamera;
import mabeijianxi.camera.util.DeviceUtils;

/**
 * User: wshx(387759689@qq.com)
 * Date: 2017-01-20
 * Time: 14:59
 * FIXME
 */
public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        initSmallVideo(getApplicationContext());
    }

    public static void initSmallVideo(Context context) {
        // 设置拍摄视频缓存路径
        File dcim = Environment
                .getExternalStorageDirectory();
        if (DeviceUtils.isZte()) {
            if (dcim.exists()) {
                VCamera.setVideoCachePath(dcim + "/wshx/");
            } else {
                VCamera.setVideoCachePath(dcim.getPath().replace("/sdcard/",
                        "/sdcard-ext/")
                        + "/wshx/");
            }
        } else {
            VCamera.setVideoCachePath(dcim + "/wshx/");
        }
        VCamera.setDebugMode(true);
        VCamera.initialize(context);
    }
}
